cd C:\Users\alen_\Dropbox\burning_glass\data

*** Figure 2

use temp, clear
keep if year >= 2015
** Define remote categories
	drop remote_occ
	
	gen remote_occ=0
	replace remote_occ=1 if dremote>0.11 & dremote<0.15
	replace remote_occ=2 if dremote>=0.15 & dremote<.
	replace remote_occ=. if dremote==.

	
	drop post 
	gen post=0
	replace post=1 if year>=2020 
	replace post=0 if year==2020 & month>=1 & month<=3
	
	gen job_cat = .
	replace job_cat = 1 if remote_occ == 2 
	replace job_cat = 2 if remote_occ == 1 
	replace job_cat = 3 if remote_occ == 0 
	
	reghdfe ln_hrlysalary, absorb(fe1=i.year#i.job_cat#c.ln_emp fe2=i.year#c.ln_emp i.year##i.job_cat edu onet_group jobhours_group taxterm_group naics_group year month) cluster(metrofips)

	gen fe = fe1 + fe2 

	collapse fe, by(job_cat year)
	sort job_cat year 

	by job_cat: gen temp=fe if year == 2019
		by job_cat: egen fe2019=max(temp)
		drop temp
	gen fe_norm=fe-fe2019


	graph twoway (line fe_norm year if job_cat==1, lpattern(solid) lcolor(black)) (line fe_norm year if job_cat==3, lpattern(shortdash) lcolor(black)), legend(lab(1 "High WFH Adoption") lab(2 "Low WFH Adoption") size(small)) graphregion(color(white)) ytitle(Urban Wage Premium (Normalized to 2019), size(small)) xlab(2015(1)2023) xline(2019, lcolor(bluishgray))
		

	

	**** Regression results

u temp, clear

keep if year>=2018

capture drop remote_occ

g remote_occ=0
replace remote_occ=1 if dremote>0.11 & dremote<0.15
replace remote_occ=2 if dremote>0.15 & dremote<.

merge m:1 metrofips using metrofips_emp_2018_q1
drop if _merge==2
drop _merge

merge m:1 onet metrofips using onet_metrofips_emp_adj_total
drop if _merge==2
drop _merge

merge m:1 metrofips using dpop_metro_2020_2023
drop if _merge==2
drop _merge

g ln_emp_msa=ln(emp_msa)

g ln_emp_adj=ln(emp_adj)

drop post 

g post=0
replace post=1 if year>=2020 
replace post=0 if year==2020 & month>=1 & month<=3

g remote_alter=0
replace remote_alter=1 if occfamname=="Business and Financial Operations Occupations" | occfamname=="Computer and Mathematical Occupations"

g local_service=0 if naics3>0
replace local_service=1 if naics3>=230 & naics3<=239
replace local_service=1 if naics3>=441 & naics3<=459
replace local_service=1 if naics3==485
replace local_service=1 if naics3>=531 & naics3<=533
replace local_service=1 if naics3==562
replace local_service=1 if naics3>=610 & naics3<=619
replace local_service=1 if naics3>=620 & naics3<=629
replace local_service=1 if naics3>=710 & naics3<=719
replace local_service=1 if naics3>=720 & naics3<=729
replace local_service=1 if naics3==811 | naics3==812

merge 1:1 bgtjobid using temp_skill

drop _merge

g soc_3digit=substr(onet,1,4)

merge m:1 soc_3digit using bloom_measure_remote
keep if _merge==3
drop _merge 

g remote_cat=0
replace remote_cat=2 if dpercent>=9.7 & dpercent<.
replace remote_cat=1 if dpercent>=2.8 & dpercent<9.7

merge m:1 naics3 metrofips using input_employment_metrofips
drop if _merge==2
drop _merge
merge m:1 naics3 metrofips using output_employment_metrofips
drop if _merge==2
drop _merge
g emp_input_output=emp_input+emp_output
g ln_emp_input_output=ln(emp_input_output)

merge m:1 onet using onet_education_requirement
drop if _merge==2
drop _merge

g high_college=0
replace high_college=1 if college_req>=50 & college_req<.

merge m:1 county using county_data 
drop if _merge==2
drop _merge 

merge m:1 onet using remote_adoption_career_shock1
drop if _merge==2
drop _merge 

ren remote_adj remote_adj1

merge m:1 onet using remote_adoption_career_shock2
drop if _merge==2
drop _merge 

ren remote_adj remote_adj2

g remote_adj=(remote_adj1+remote_adj2)/2

merge m:1 naics3 using remote_adoption_output_share
drop if _merge==2
drop _merge 

ren dremote_secondary dremote_secondary_output

merge m:1 naics3 using remote_adoption_input_share
drop if _merge==2
drop _merge 

ren dremote_secondary dremote_secondary_input

g dremote_secondary=(dremote_secondary_input+dremote_secondary_output)/2

g ln_emp_county=ln(emp_county)

merge m:1 metrofips using bloom_measure_remote_metro
drop if _merge==2
drop _merge 

merge 1:1 bgtjobid using employer
egen employer_id=group(employer)

****

** Table 1
** Column 1
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)

lincom 1.post#c.ln_emp 
lincom 1.post#c.ln_emp +1.post#1.remote_occ#c.ln_emp
lincom 1.post#c.ln_emp +1.post#2.remote_occ#c.ln_emp

** Column 2

reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month i.onet_group skill1 skill2 skill3 skill4 skill5 skill6 skill7 skill8 skill9 skill10) cluster(metrofips)

lincom 1.post#c.ln_emp 
lincom 1.post#c.ln_emp +1.post#1.remote_occ#c.ln_emp
lincom 1.post#c.ln_emp +1.post#2.remote_occ#c.ln_emp

* Column 3
reghdfe ln_hrlysalary i.post##i.remote_alter##c.ln_emp, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)

lincom 1.post#c.ln_emp 
lincom 1.post#c.ln_emp +1.post#1.remote_alter#c.ln_emp

* Column 4 
reghdfe ln_hrlysalary i.post##i.remote_cat##c.ln_emp if remote_cat!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)

* Column 5
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp i.year##i.remote_occ##c.dpop2020 i.year##i.remote_occ##c.dpop2023 if remote_occ!=1 & occfamname!="Building and Grounds Cleaning and Maintenance Occupations" &  occfamname!="Construction and Extraction Occupations" &  occfamname!="Transportation and Material Moving Occupations" &  occfamname!="Installation, Maintenance, and Repair Occupations" &  occfamname!="Personal Care and Service Occupations" & occfamname!="Community and Social Service Occupations" & occfamname!="Food Preparation and Serving Related Occupations" & occfamname!="Farming, Fishing, and Forestry Occupations" , absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)



***********************************
***** Table 2

* Column 1
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp if remote_occ!=1 & remote_job!=., absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)

* Column 2
reghdfe ln_hrlysalary i.post##i.remote_job##c.ln_emp i.post##i.remote_occ##c.ln_emp if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)

* Column 3
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp if remote_occ!=1 & remote_job==0, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)

** For Columns 4-5, please see regression_acs.do. 


**************************************


***** Table A1
* Column 1
reghdfe ln_hrlysalary i.post##c.ln_emp, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)
* Column 2
reghdfe ln_hrlysalary i.post##c.ln_emp_msa, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)

*******************
*** Table A2 

* Column 1
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp i.post##i.remote_occ##c.dpercent_metro if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)
* Column 2
reghdfe ln_hrlysalary i.post##i.remote_occ##c.dpercent_metro##c.ln_emp if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)

*********************
*** Table A3 

* Column 1 
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group##i.post i.metrofips##i.post) cluster(metrofips)
* Column 2
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group i.employer_id) cluster(metrofips)
* Column 3 
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp if remote_occ!=1 & year!=2020 & year!=2021, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month ) cluster(metrofips)
* Column 4
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp_county if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) vce(cluster county)
* Column 5
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp_county if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group i.metrofips##i.post#i.remote_occ) vce(cluster county) 

*****************
*** Table A9 
* Column 1
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp_msa if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)
* Column 2
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp i.post##i.remote_occ##c.ln_emp_msa if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)
* Column 3
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp i.post##i.remote_occ##c.ln_emp_adj i.post##i.remote_occ##c.ln_emp_msa if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)
* Column 4
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp i.post##i.remote_occ##c.ln_emp_input_output i.post##i.remote_occ##c.ln_emp_adj i.post##i.remote_occ##c.ln_emp_msa if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)


************** 
** Table A10 

* Column 1
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp i.post##c.remote_adj##c.ln_emp  if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)
* Column 2
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp i.post##c.dremote_secondary##c.ln_emp  if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)
* Column 3
reghdfe ln_hrlysalary i.post##i.remote_occ##c.ln_emp i.post##c.remote_adj##c.ln_emp  i.post##c.dremote_secondary##c.ln_emp if remote_occ!=1, absorb(i.edu i.year i.naics_group i.jobhours_group i.taxterm_group i.month  i.onet_group) cluster(metrofips)

